import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const state={
	usernamevuex:'',
	isLogin:false,
	token:''
}

const actions={
	leave(context,value){
		if(value===''){
			context.commit('LEAVE',value)
		}
	}
}
const mutations={
	LEAVE(state,value){
		state.usernamevuex=value
	},
	NAME(state,value){
		state.usernamevuex=value
	}
}
const getters={
	usernameget:(state)=>{
		uni.getStorage({
			key:'username',
			success: (res) => {
				state.usernamevuex=res
			}
		})
		return state.usernamevuex
	}
}
export default new Vuex.Store({
	state,
	mutations,
	actions,
	getters
})